using System;
using System.IO;

namespace UraniaLib
{
	/// <summary>
	/// Summary description for UraniaStarData.
	/// </summary>
	public class UraniaStarData
	{
		public DateTime dEpoch = new DateTime(2000, 1, 1);

		public double[] fDecl;
		public double[] fRA;
		public double[] fMag;
		public string[] sName;
		public string[] sDesignation;
		public string[] sSpectralType;
		public long lStarCount;

		public UraniaStarData(string sCatalog, long lCount)
		{
			FileStream oFile = new FileStream(sCatalog, FileMode.OpenOrCreate, FileAccess.Read);
			StreamReader oRead = new StreamReader(oFile);
			string sLine = "";
			string[] aLine;
			long i;
			lStarCount = lCount;

			fDecl = new double[lStarCount];
			fRA = new double[lStarCount];
			fMag = new double[lStarCount];
			sName = new string[lStarCount];
			sDesignation = new string[lStarCount];
			sSpectralType = new string[lStarCount];

			if (oFile.Length > 1)
			{
				for (i = 0; i < lStarCount; i++)
				{
					sLine = oRead.ReadLine();

					aLine = sLine.Split(',');
					sDesignation[i] = aLine[0].Trim(); 
					fRA[i] = Convert.ToDouble(aLine[1].Trim()); 
					fDecl[i] = Convert.ToDouble(aLine[2].Trim()); 
					fMag[i] = Convert.ToDouble(aLine[3].Trim()); 
					sName[i] = aLine[4].Trim(); 
				}
			}
			oRead.Close();
			oFile.Close();
		}
	}
}
